package com.example;

import com.example.util.RsaUtils;
import org.junit.jupiter.api.Test;

public class GenerateKey {

    @Test
    public void createKeys() throws Exception {
        String privateFilePath ="F:\\key\\rsa.pri";
        String publicFilePath = "F:\\key\\rsa.pub";

        //生成
        RsaUtils.generateKey(publicFilePath,privateFilePath,"allen123",2048);
        //获取私钥
        System.out.println(RsaUtils.getPrivateKey(privateFilePath));
        //打印分割线
        System.out.println("----------------------------------------------");
        //获取公钥
        System.out.println(RsaUtils.getPublicKey(publicFilePath));
    }
}
